package com.example.demo.controller;

import com.example.demo.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.ExecutionException;

@RestController
@RequestMapping("order")
public class OrderController {
    @Autowired
    OrderService orderService;

    @PostMapping("/batchInsert")
    public int batchInsert() {
        return orderService.batchInsert();
    }


    @PostMapping("/batchInsertByForkJoin")
    public int batchInsertByForkJoin() throws ExecutionException, InterruptedException {
        return orderService.batchInsertByForkJoin();
    }

}
